package com.hk.common.websocket.bean;

import java.io.Serializable;

public class Operation implements Serializable {

    /**
     * uuid   发送前设置 这样每个Operation不一样，前端watch会方便一些
     */
    private String uuid;

    /**
     * 目标IP
     */
    private String clientIP;
    /**
     * 操作code
     */
    private OperationCodeEnum code;
    /**
     * 备注note
     */
    private String note;
    /**
     * 对象信息
     */
    private Object object;

    public OperationCodeEnum getCode() {
        return code;
    }

    public void setCode(OperationCodeEnum code) {
        this.code = code;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    public String getClientIP() {
        return clientIP;
    }

    public void setClientIP(String clientIP) {
        this.clientIP = clientIP;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public Operation() {
    }

    /**
     * 构造函数
     * @param clientIP
     * @param code
     */
    public Operation(String clientIP, OperationCodeEnum code) {
        this.clientIP = clientIP;
        this.code = code;
    }

    /**
     * 构造函数
     * @param clientIP
     * @param code
     * @param note
     * @param object
     */
    public Operation(String clientIP, OperationCodeEnum code, String note, Object object) {
        this.clientIP = clientIP;
        this.code = code;
        this.note = note;
        this.object = object;
    }

    /**
     * 内部enum
     */
    public enum OperationCodeEnum {
        /**
         * 心跳
         */
        heart_beat,
        /**
         * 刷新
         */
        refresh,
        /**
         * 显示消息
         */
        showmsg,
        /**
         * 接口处理过程消息
         */
        process_msg,
        /**
         * 浏览器刷新
         */
        browser_refresh;
    }
}
